|
Microwave filters GUI
2.0.3
|
Event filter for the canvas. More...
Public Member Functions | |
| def | __init__ |
| Class constructor. | |
| def | eventFilter |
| The event filter. | |
Event filter for the canvas.
This filter is necessary to pick up events that are not handled by the QwtPlotPicker class, like mouse dragging.
It would be enough (and better practice) to reimplement mousePressEvent() and keyPressEvent() of the QwtPlotCanvas class, but we if we create a derived class from QwtPlotCanvas it is not possible to set an instance of this class to the canvas of a QwtPlot object since there is not setPlotCanvas() method in QwtPlot class.
To handle left mouse clicks it is enough to create a mouseClicked() slot and connect to 'selected' signal of QwtPlotPicker class: self.connect(pickerLeft, SIGNAL('selected(QwtDoublePoint)'), self.mouseClicked ) but since we have to implement this filter anyway in order to handle mouse dragging, we will handle also all the other events here.
Reimplementation of mousePressEvent() from QwtPlot does not work, because we need the mouse coordinates obtained from event.pos() to be relative to the QwtPlotCanvas widget, not to the QwtPlot, in order to get the graph coordinates using QwtPlot.invTransform().
Implementing this filter is essentially what the QwtPlotPicker class does, but unfortunately it does not support mouse dragging, only mouse selection.
| def dbplot.CanvasEventFilter.__init__ | ( | self, | |
| dbplot, | |||
| hPlot | |||
| ) |
Class constructor.
| dbplot | = DbPlot class instance, necessary to check the value of some dbPlot flags. |
| hPlot | = The parent widget. Must be a Qwt.QwtPlot class instance, since non-processed events will be sent to Qwt.QwtPlot.eventFilter(self, object, event). |
Definition at line 2229 of file dbplot.py.
References dbplot.MyPicker.dbplot, and dbplot.CanvasEventFilter.dbplot.
| def dbplot.CanvasEventFilter.eventFilter | ( | self, | |
| object, | |||
| event | |||
| ) |
1.8.1.2